﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using clBD;

namespace clBUS
{
    public class BUSBase
    {
        private string cadBD;
        public BUSBase(String cadBD)
        {
            this.cadBD = cadBD;
        }
        public OleDbConnection getCn()
        {
            OleDbConnection cn = new OleDbConnection(this.cadBD);
            cn.Open();
            return cn;
        }
        public void grabarElemento(String elemento, String nombre)
        {
            BDBase objBD = new BDBase(getCn());
            objBD.grabarElemento ( elemento, nombre);
        }
        public List<String> getElementos(String elemento)
        {
            List<String> elems = null;
            BDBase objBD = new BDBase(getCn());
            OleDbDataReader dr = objBD.getElementos(elemento);
            elems = new List<string>();
            while (dr.Read())
            {
                elems.Add(dr.GetString(0));
            }
            return elems;
        }

    }
}
